{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Notebook for preparing and saving MOLECULAR (ZINC full) graphs"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "import torch\n",
    "import pickle\n",
    "import time\n",
    "import os\n",
    "%matplotlib inline\n",
    "import matplotlib.pyplot as plt\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Download ZINC full dataset"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "File already downloaded\n"
     ]
    }
   ],
   "source": [
    "if not os.path.isfile('molecules_zinc_full.zip'):\n",
    "    print('downloading..')\n",
    "    !curl https://www.dropbox.com/s/grhitgnuuixoxwl/molecules_zinc_full.zip?dl=1 -o molecules_zinc_full.zip -J -L -k\n",
    "    !unzip molecules_zinc_full.zip -d ../\n",
    "    # !tar -xvf molecules_zinc_full.zip -C ../\n",
    "else:\n",
    "    print('File already downloaded')\n",
    "    "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Convert to DGL format and save with pickle"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "/home/vijay/graphdeeplearning/benchmarking-gnns\n"
     ]
    }
   ],
   "source": [
    "import os\n",
    "os.chdir('../../') # go to root folder of the project\n",
    "print(os.getcwd())\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The autoreload extension is already loaded. To reload it, use:\n",
      "  %reload_ext autoreload\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "Using backend: pytorch\n"
     ]
    }
   ],
   "source": [
    "import pickle\n",
    "\n",
    "%load_ext autoreload\n",
    "%autoreload 2\n",
    "\n",
    "from data.molecules import MoleculeDatasetDGL \n",
    "\n",
    "from data.data import LoadData\n",
    "from torch.utils.data import DataLoader\n",
    "from data.molecules import MoleculeDataset\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "preparing 220011 graphs for the TRAIN set...\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/home/vijay/graphdeeplearning/benchmarking-gnns/data/molecules.py:61: UserWarning: This overload of nonzero is deprecated:\n",
      "\tnonzero()\n",
      "Consider using one of the following signatures instead:\n",
      "\tnonzero(*, bool as_tuple) (Triggered internally at  /opt/conda/conda-bld/pytorch_1595629427478/work/torch/csrc/utils/python_arg_parser.cpp:766.)\n",
      "  edge_list = (adj != 0).nonzero()  # converting adj matrix to edge_list\n",
      "/home/vijay/miniconda3/envs/benchmark_gnn_dgl_05/lib/python3.7/site-packages/dgl/base.py:45: DGLWarning: Recommend creating graphs by `dgl.graph(data)` instead of `dgl.DGLGraph(data)`.\n",
      "  return warnings.warn(message, category=category, stacklevel=1)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "preparing 24445 graphs for the VAL set...\n",
      "preparing 5000 graphs for the TEST set...\n",
      "Time taken: 4012.6295s\n"
     ]
    }
   ],
   "source": [
    "DATASET_NAME = 'ZINC-full'\n",
    "dataset = MoleculeDatasetDGL(DATASET_NAME) \n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYQAAAEICAYAAABfz4NwAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjAsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+17YcXAAAY9klEQ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TZk+TJJI8nGZrr/kwkya1JDiR5qqt2apL7k/ygvZ8yl30czxj9vzbJi+2/weNJLpzLPo4lybIk30ryTJJdSa5q9Xl//sfp+6Cc+3cmeSTJ91r/P9/qg3Dux+r7QJz7fhwz9xCS7AFWV9VAfLklyV8HXgdur6qVrfb7wMtVdV37e06nVNXvzGU/xzJG/68FXq+qfzOXfZtIksXA4qp6LMl7gEeBi4HfYJ6f/3H6/nEG49wHeFdVvZ7kBOA7wFXA32X+n/ux+r6OATj3/ThmrhAGTVV9G3h5VHk9sK0tb6PzD31eGqP/A6Gq9lXVY235IPAMnW/Lz/vzP07fB0J1vN4+ntBexWCc+7H6fsw4lgKhgD9P8mj7ExeD6Myq2gedf/jAGXPcn6n4VJIn2pDSvLvsHy3JcuCDwE4G7PyP6jsMyLlPsiDJ48AB4P6qGphzP0bfYUDO/USOpUD4UFX9Mp2/mHplG9LQ7LoZeB+wCtgHfGFuuzO+JO8Gvgp8uqp+PNf9mYwefR+Yc19VR6pqFZ2/SLAmycq57lO/xuj7wJz7iRwzgVBVL7X3A8DX6fwF1UGzv40Rj4wVH5jj/kxKVe1v/2DeBL7EPP5v0MaAvwp8uaq+1soDcf579X2Qzv2IqnoVeIjOGPxAnPsR3X0fxHM/lmMiEJK8q91gI8m7gF8Dnhq/1by0A9jYljcC98xhXyZt5B908zHm6X+DdnPwFuCZqvpi16p5f/7H6vsAnftFSd7blk8EPgJ8n8E49z37Pijnvh/HxFNGSX6RzlUBdP4cx59U1ZY57NKEknwF+DCdP527H/gc8KfAduDngeeBS6tqXt64HaP/H6Zz2VzAHuDykXHh+STJXwP+K/Ak8GYrf5bOWPy8Pv/j9P0TDMa5/yU6N40X0PmFdHtV/W6S05j/536svt/BAJz7fhwTgSBJmr5jYshIkjR9BoIkCTAQJEmNgSBJAgwESVJjIEiSAANBktT8P7TamY1LteUbAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "min/max : 6 38\n"
     ]
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAX0AAAEICAYAAACzliQjAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjAsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+17YcXAAAQ10lEQVR4nO3df8ydZX3H8ffHgkhUAoxCsGUWl8YMyIbSIYvOETBaxKy4DFPMRmdIaghGTJbM4v5QlzSpi3OTRFjY5iibyLqhoxGJEiZzLih7YChCJVSpUGG0isQSNxLguz/OxXb2cJ5f9Ol5nsP1fiUn5z7f+77u8z130s9z97rPj1QVkqQ+vGypG5AkjY+hL0kdMfQlqSOGviR1xNCXpI4Y+pLUEUNfmqckZyfZu9R9SAfD0JfGKMmaJJXksKXuRX0y9CWpI4a+upNkS5J/nFb7dJIrk7wvya4kB5L8IMn7Z9nPh5P8qG37QJJzW/1l7Tm+n+QnSXYkObYN+3q7fzLJU0l+/dC8Smk0Q189+jzwziRHASRZAbwHuB7YB7wLOAp4H/BnSd44fQdJXg98APi1qno18A5gT1v9QeAC4DeB1wA/BT7T1r213R9dVa+qqjsW/dVJszD01Z2q+iFwN4NgBjgH+HlVfbOqbq6q79fAvwBfBX5jxG6eBY4ATklyeFXtqarvt3XvB/6oqvZW1dPAx4DfcR5fy4Ghr15dD1zUlt/bHpPkvCTfTPJEkieBdwLHTR9cVbuBDzEI9H1Jbkjymrb6tcAXkzzZ9rGLwR+JEw7lC5Lmw9BXr/4BODvJauDdwPVJjgBuBD4JnFBVRwNfBjJqB1V1fVW9hUHIF/CJtuoR4LyqOnro9oqq+lHbTloyhr66VFX7gduBvwEeqqpdwMsZTNnsB55Jch7w9lHjk7w+yTntD8V/A//F4Gwe4C+ArUle27ZdmWRDW7cfeA543SF5Y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Sjv1M/U+EGniqPTy83YoJOP6z9P6SMImhX8BXk9zVvq5hEp1QVY/B4B83cPwS97NQH0jynTb9s+z+ez5dkjXAG4BvMYHHflr/MCHHP8mKJPcA+4Bbq2pijv8MvcOEHPvZTGLov7mq3sjgmzova1MQGp+rgV8CTgceA/50aduZXZJXATcCH6qqny11Pws1ov+JOf5V9WxVnc7gk/dnJjltqXuarxl6n5hjP5uJC/2qerTd7wO+yOCbOyfN423O9vm5231L3M+8VdXj7R/Ec8BfsoyPf5uPvRH4XFV9oZUn5tiP6n+Sjv/zqupJ4HYGc+ITc/zh//c+icd+lIkK/SSvbBe1SPJK4O3Ad2cftSztBDa15U3ATUvYy4I8/w+2eTfL9Pi3i3F/Deyqqk8NrZqIYz9T/xN0/FcmObotHwm8DfgeE3D8Z+p9Uo79XCbq3TtJXsfg7B4GXyFxfVVtXcKW5pTk88DZDL6W9XHgo8A/ATuAXwQeBi6sqmV3wXSG3s9m8N/bAvYA739+jnY5SfIW4F+Be4HnWvkjDObFJ+HYz9T/RUzG8f8VBhdqVzA4udxRVX+c5BdY5sd/lt7/lgk49nOZqNCXJB2ciZrekSQdHENfkjpi6EtSRwx9SeqIoS9JHTH0Jakjhr4kdeR/AMUSJGdgvBm9AAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "min/max : 6 38\n"
     ]
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXcAAAEICAYAAACktLTqAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjAsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+17YcXAAAQDklEQVR4nO3df6zdd13H8eeLlg0YQzp3t5S20GIq2C0IpA4QgovDbFK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s5ukk43k94ztHz6P3A9NF9E4ad1TVXyT5WcZzjgaN58OMyRyd8eEuSS1yWUaSGmS4S1KDDHdJapDhLkkNMtwlqUGGuyQ1yHCXpAb9P++50/xaAb7hAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "min/max : 8 37\n"
     ]
    }
   ],
   "source": [
    "def plot_histo_graphs(dataset, title):\n",
    "    # histogram of graph sizes\n",
    "    graph_sizes = []\n",
    "    for graph in dataset:\n",
    "        graph_sizes.append(graph[0].number_of_nodes())\n",
    "    plt.figure(1)\n",
    "    plt.hist(graph_sizes, bins=20)\n",
    "    plt.title(title)\n",
    "    plt.show()\n",
    "    graph_sizes = torch.Tensor(graph_sizes)\n",
    "    print('min/max :',graph_sizes.min().long().item(),graph_sizes.max().long().item())\n",
    "    \n",
    "plot_histo_graphs(dataset.train,'trainset')\n",
    "plot_histo_graphs(dataset.val,'valset')\n",
    "plot_histo_graphs(dataset.test,'testset')\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 40,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "220011\n",
      "24445\n",
      "5000\n",
      "(Graph(num_nodes=33, num_edges=72,\n",
      "      ndata_schemes={'feat': Scheme(shape=(), dtype=torch.int64)}\n",
      "      edata_schemes={'feat': Scheme(shape=(), dtype=torch.int64)}), tensor([3.0464]))\n",
      "(Graph(num_nodes=21, num_edges=44,\n",
      "      ndata_schemes={'feat': Scheme(shape=(), dtype=torch.int64)}\n",
      "      edata_schemes={'feat': Scheme(shape=(), dtype=torch.int64)}), tensor([2.0992]))\n",
      "(Graph(num_nodes=24, num_edges=52,\n",
      "      ndata_schemes={'feat': Scheme(shape=(), dtype=torch.int64)}\n",
      "      edata_schemes={'feat': Scheme(shape=(), dtype=torch.int64)}), tensor([3.1382]))\n"
     ]
    }
   ],
   "source": [
    "print(len(dataset.train))\n",
    "print(len(dataset.val))\n",
    "print(len(dataset.test))\n",
    "\n",
    "print(dataset.train[0])\n",
    "print(dataset.val[0])\n",
    "print(dataset.test[0])\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 41,
   "metadata": {},
   "outputs": [],
   "source": [
    "num_atom_type = 28\n",
    "num_bond_type = 4\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 42,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Time (sec): 133.74254989624023\n"
     ]
    }
   ],
   "source": [
    "start = time.time()\n",
    "with open('data/molecules/ZINC-full.pkl','wb') as f:\n",
    "        pickle.dump([dataset.train,dataset.val,dataset.test,num_atom_type,num_bond_type],f)\n",
    "print('Time (sec):',time.time() - start)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Test load function"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 43,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[I] Loading dataset ZINC-full...\n",
      "train, test, val sizes : 220011 5000 24445\n",
      "[I] Finished loading.\n",
      "[I] Data load time: 151.4532s\n"
     ]
    }
   ],
   "source": [
    "DATASET_NAME = 'ZINC-full'\n",
    "dataset = LoadData(DATASET_NAME)\n",
    "trainset, valset, testset = dataset.train, dataset.val, dataset.test\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 44,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<class 'data.molecules.MoleculeDataset'>\n"
     ]
    }
   ],
   "source": [
    "batch_size = 10\n",
    "collate = MoleculeDataset.collate\n",
    "print(MoleculeDataset)\n",
    "train_loader = DataLoader(trainset, batch_size=batch_size, shuffle=True, collate_fn=collate)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
